package org.stbernardpreserve.calendartest.server;

import org.stbernardpreserve.calendartest.client.GreetingService;
import org.stbernardpreserve.calendartest.shared.FieldVerifier;
import com.google.gwt.user.server.rpc.RemoteServiceServlet;

/**
 * The server side implementation of the RPC service.
 */
@SuppressWarnings("serial")
public class GreetingServiceImpl extends RemoteServiceServlet implements
		GreetingService {

	public String greetServer(String input) throws IllegalArgumentException {
		// Verify that the input is valid. 
		if (!FieldVerifier.isValidName(input)) {
			// If the input is not valid, throw an IllegalArgumentException back to
			// the client.
			throw new IllegalArgumentException(
					"Name must be at least 4 characters long");
		}

		return getAgendaFromCalendar();
	}
	
	
	
	protected String getAgendaFromCalendar()
	{
		return "Dude, you are so cool!";
	}
}
